import * as NS from "../../Common/NetServices";
import { IsNull } from "../../TYLibrary/Common/GlobalExtend";
import {
    Wx_XSPPage,
    V_Product,
    V_ShoppingCart,
    V_ShoppingCartHelper,
    V_Cart
} from "../../Common/Entitys";
import { Log } from "../../TYLibrary/System/Logger";
import { Wx_PageData, WXDataClassRuntimeDecorator } from "../../Common/EntityBase";
import { List } from "../../TYLibrary/System/Collections";

@WXDataClassRuntimeDecorator()
class IndexPageData extends Wx_PageData {
    // public CartList: List<V_Cart> = new  List<V_Cart>();
    public CartList: Array<V_Cart> = new Array<V_Cart>();
}

class FirmOrderPage extends Wx_XSPPage {
    public Data = new IndexPageData();

    /**
     * 初始化页面信息
     * @param {any} options
     * @returns {Promise<void>}
     * @memberof IndexPage
     */
    public async InitData(options: any): Promise<void> {
        try {
            wx.showLoading({
                title: "数据加载中..."
            });
            this.Data.CartList = await NS.QuerySelectedUserCart();
            this.Data.ApplyChange(this);
        } catch (e) {
        } finally {
        }
    }

    /**
     *
     * @param {*} e
     * @memberof FirmOrderPage
     */
    public LocationHandler(e: any): void {
        try {
            //     let type = e.currentTarget.dataset.type;
            //     let id = e.currentTarget.dataset.id;
            //     let cardbill = e.currentTarget.dataset.cardbill;
            //  console.log(e, 'ssssssssssssssssssssssssssssssssssssssssssss');
            wx.navigateTo({
                url: "../UserInfo/AddressList"
            });
        } catch (e) {}
    }
}

Page(new FirmOrderPage());
